package com.atguigu.mapreduce.utils;

import lombok.extern.slf4j.Slf4j;

/**
 * @version V1.0
 * @author: guangcheng
 * @date: 2021/11/12 16:54
 * @description:
 */
@Slf4j
public class RCloseUtil {

    private RCloseUtil() {

    }


    public static void close(AutoCloseable... args) {
        if (args != null) {
            for (AutoCloseable arg : args) {
                try {
                    arg.close();
                    log.info("关闭相关资源 {} 已关闭!", arg.getClass().toString());
                } catch (Exception e) {
                    log.info("关闭相关资源 {} 关闭出错,请排查问题!", arg.getClass().toString());
                    log.info("{}", e.getMessage());
                }
            }
        }
    }


}

